<?php

/*
 * author:pipistrll
 * email:appyouxiang@163.com
 */
class SiteController extends Controller {
   public $isType = 0;
   public $isSmallType = 0;
    public function filters()
              {
                     return array(
                            array(
                                   'application.admin.filters.MemcheckFilter - login,regin,loginout,Aimage'
                            )
                     );
              }
    
    public function actionLogin(){
        
        $this->renderPartial('login',array(
             'msg'=>'请输入用户名密码'
         ));
    }
    public function actionIndex() {  
       
        $this->layout='application.admin.views.layouts.main';
         $this->render('index');
    }
    public function actionLogout(){
        Yii::app()->user->logout();
        Yii::app()->session->clear();
        Yii::app()->session->destroy();
        $this->redirect(Yii::app()->homeUrl);
    }
   public function actionError(){
        $msg = empty($_GET['msg'])?'您要的页面未找到！':$_GET['msg'];
        $this->renderPartial('error',array(
            'msg'=>$msg
        ));
    }
   public function actionShowMail(){
       $this->layout='application.admin.views.layouts.main';
        $this->render('sendMail');
   }
   public function actionSendMail(){
        $mail = new JPhpMailer();
        $mail->IsSMTP();
        $mail->Host = 'smtp.163.com';
        $mail->SMTPAuth = true;
        $mail->Username = 'appyouxiang@163.com';
        $mail->Password = '89507695';
        $mail->SetFrom('appyouxiang@163.com', '使用人员');
        $mail->Subject = $_POST['title'];
        $mail->MsgHTML(' <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> '.$_POST['advise'].'<br />邮箱：'.$_POST['mail']);
        $mail->AddAddress('289404562@qq.com', 'pipistrell');
        if(!$mail->Send()){
            echo 2;return;
        }
        echo 1;
   }
}